      module mo_lu_solve
      private
      public :: lu_slv
      contains
      subroutine lu_slv01( lu, b )
      use shr_kind_mod, only : r8 => shr_kind_r8
      use chem_mods, only : clscnt4, nzcnt
      implicit none
!-----------------------------------------------------------------------
! ... Dummy args
!-----------------------------------------------------------------------
      real(r8), intent(in) :: lu(:)
      real(r8), intent(inout) :: b(:)
!-----------------------------------------------------------------------
! ... Local variables
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
! ... solve L * y = b
!-----------------------------------------------------------------------
         b(3) = b(3) - lu(3) * b(2)
      end subroutine lu_slv01
      subroutine lu_slv02( lu, b )
      use shr_kind_mod, only : r8 => shr_kind_r8
      use chem_mods, only : clscnt4, nzcnt
      implicit none
!-----------------------------------------------------------------------
! ... Dummy args
!-----------------------------------------------------------------------
      real(r8), intent(in) :: lu(:)
      real(r8), intent(inout) :: b(:)
!-----------------------------------------------------------------------
! ... Local variables
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
! ... solve L * y = b
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
! ... Solve U * x = y
!-----------------------------------------------------------------------
         b(3) = b(3) * lu(5)
         b(2) = b(2) - lu(4) * b(3)
         b(2) = b(2) * lu(2)
         b(1) = b(1) * lu(1)
      end subroutine lu_slv02
      subroutine lu_slv( lu, b )
      use shr_kind_mod, only : r8 => shr_kind_r8
      use chem_mods, only : clscnt4, nzcnt
      implicit none
!-----------------------------------------------------------------------
! ... Dummy args
!-----------------------------------------------------------------------
      real(r8), intent(in) :: lu(:)
      real(r8), intent(inout) :: b(:)
      call lu_slv01( lu, b )
      call lu_slv02( lu, b )
      end subroutine lu_slv
      end module mo_lu_solve
